package com.qf.mapper;

import com.qf.pojo.Student;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@CacheNamespace //开启二级缓存
public interface StudentMapper {

    /**
     * 查询所有学生， 同时查询学生所在班级
     * @return
     */
    @Select("SELECT s.*,c.`NAME` cname\n" +
            "FROM student s LEFT JOIN classes c ON s.cid=c.id")
    @ResultMap("stuMap")
    List<Student> findAll();
}
